package com.netty.controller;

import com.netty.domain.IMessage;
import com.netty.service.PushService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author sixiaojie
 * @date 2020-03-30-20:08
 */
@RestController
@RequestMapping("/push")
public class PushController {

    @Autowired
    private PushService pushService;

    /**
     * 推送给所有用户
     * @param message
     */
    @PostMapping("/pushAll")
    public void pushToAll(@RequestBody IMessage message){
        pushService.pushMsgToAll(message);
    }

    /**
     * 推送给指定用户
     * @param message
     */
    @PostMapping("/pushOne")
    public void pushMsgToOne(@RequestBody IMessage message){
        pushService.pushMsgToOne(message);
    }

}
